// run: $exec < input
#include <iostream>
#include <algorithm>
#include <iostream>

int main()
{
	std::string s;
	std::cin >> s;
	int m;
	std::cin >> m;
	for (int i = 0; i < m; i++) {
		int t; std::cin >> t;
		if (1 <= t) std::reverse(s.begin(), s.begin() + t);
		if (t + 1 <= (int)s.size()) std::reverse(s.begin() + t, s.end());
	}
	std::cout << s << '\n';
}

